from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By

path = Service(executable_path=r'C:\Users\Laptop\Desktop\thirty_one\chromedriver.exe')
driver = webdriver.Chrome(service=path)
driver.get('https://baidu.com')

driver.maximize_window() # 窗口最大化
# driver.minimize_window() # 窗口最小化
# # driver.get() # 打开网址
# driver.get_cookies() # 获取cookies
# driver.forward() # 前进
# driver.back() # 后退
# driver.refresh() # 刷新
# driver.find_element().click() # 点击
# driver.find_element(By.NAME,'wd').send_keys('selenium') # 输入
# driver.get_screenshot_as_file('输入.png')
# driver.find_element(By.NAME,'wd').clear() # 清空
# driver.get_screenshot_as_file('清空.png') # 截图
# driver.find_element().submit() # 提交，和click操作是一致，submit可以用于登录等场景
print(driver.name)  # 获取浏览器的名称
print(driver.title) # 获取浏览器的标题
driver.close() # 关闭当前窗口
driver.quit() # 关闭浏览器
